package cn.chenhuanming.shh.administer.entity.jpa.builder;

import cn.chenhuanming.shh.administer.entity.jpa.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by chenhuanming on 2017-07-27.
 *
 * @author chenhuanming
 */
public final class EstateBuilder {
    private String id;
    private District district;
    private String name;
    private String alias;
    private String cityName;
    private String cityAreaName;
    private String location;
    private LocalDate buildingTime;
    private Float averagePrice;
    private String developer;
    private String developerPhone;
    private Float area;
    private Short volumeRate;
    private Short greenRate;
    private Long totalHouse;
    private Short loop;
    private String propertyCompany;
    private String propertyCompanyPhone;
    private String photo;
    private UserSystem creator;
    private LocalDateTime createTime;
    private String remark;
    private String status;
    private Set<House> houses = new HashSet<House>(0);
    private Set<EstateDetails> estateDetailses = new HashSet<EstateDetails>(0);
    private Set<EstateBroker> estateBrokers = new HashSet<EstateBroker>(0);

    private EstateBuilder() {
    }

    public static EstateBuilder anEstate() {
        return new EstateBuilder();
    }

    public EstateBuilder withId(String id) {
        this.id = id;
        return this;
    }

    public EstateBuilder withDistrict(District district) {
        this.district = district;
        return this;
    }

    public EstateBuilder withName(String name) {
        this.name = name;
        return this;
    }

    public EstateBuilder withAlias(String alias) {
        this.alias = alias;
        return this;
    }

    public EstateBuilder withCityName(String cityName) {
        this.cityName = cityName;
        return this;
    }

    public EstateBuilder withCityAreaName(String cityAreaName) {
        this.cityAreaName = cityAreaName;
        return this;
    }

    public EstateBuilder withLocation(String location) {
        this.location = location;
        return this;
    }

    public EstateBuilder withBuildingTime(LocalDate buildingTime) {
        this.buildingTime = buildingTime;
        return this;
    }

    public EstateBuilder withAveragePrice(Float averagePrice) {
        this.averagePrice = averagePrice;
        return this;
    }

    public EstateBuilder withDeveloper(String developer) {
        this.developer = developer;
        return this;
    }

    public EstateBuilder withDeveloperPhone(String developerPhone) {
        this.developerPhone = developerPhone;
        return this;
    }

    public EstateBuilder withArea(Float area) {
        this.area = area;
        return this;
    }

    public EstateBuilder withVolumeRate(Short volumeRate) {
        this.volumeRate = volumeRate;
        return this;
    }

    public EstateBuilder withGreenRate(Short greenRate) {
        this.greenRate = greenRate;
        return this;
    }

    public EstateBuilder withTotalHouse(Long totalHouse) {
        this.totalHouse = totalHouse;
        return this;
    }

    public EstateBuilder withLoop(Short loop) {
        this.loop = loop;
        return this;
    }

    public EstateBuilder withPropertyCompany(String propertyCompany) {
        this.propertyCompany = propertyCompany;
        return this;
    }

    public EstateBuilder withPropertyCompanyPhone(String propertyCompanyPhone) {
        this.propertyCompanyPhone = propertyCompanyPhone;
        return this;
    }

    public EstateBuilder withPhoto(String photo) {
        this.photo = photo;
        return this;
    }

    public EstateBuilder withCreator(UserSystem creator) {
        this.creator = creator;
        return this;
    }

    public EstateBuilder withCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
        return this;
    }

    public EstateBuilder withRemark(String remark) {
        this.remark = remark;
        return this;
    }

    public EstateBuilder withStatus(String status) {
        this.status = status;
        return this;
    }

    public EstateBuilder withHouses(Set<House> houses) {
        this.houses = houses;
        return this;
    }

    public EstateBuilder withEstateDetailses(Set<EstateDetails> estateDetailses) {
        this.estateDetailses = estateDetailses;
        return this;
    }

    public EstateBuilder withEstateBrokers(Set<EstateBroker> estateBrokers) {
        this.estateBrokers = estateBrokers;
        return this;
    }

    public Estate build() {
        Estate estate = new Estate();
        estate.setId(id);
        estate.setDistrict(district);
        estate.setName(name);
        estate.setAlias(alias);
        estate.setCityName(cityName);
        estate.setCityAreaName(cityAreaName);
        estate.setLocation(location);
        estate.setBuildingTime(buildingTime);
        estate.setAveragePrice(averagePrice);
        estate.setDeveloper(developer);
        estate.setDeveloperPhone(developerPhone);
        estate.setArea(area);
        estate.setVolumeRate(volumeRate);
        estate.setGreenRate(greenRate);
        estate.setTotalHouse(totalHouse);
        estate.setLoop(loop);
        estate.setPropertyCompany(propertyCompany);
        estate.setPropertyCompanyPhone(propertyCompanyPhone);
        estate.setPhoto(photo);
        estate.setCreator(creator);
        estate.setCreateTime(createTime);
        estate.setRemark(remark);
        estate.setStatus(status);
        estate.setHouses(houses);
        estate.setEstateDetailses(estateDetailses);
        estate.setEstateBrokers(estateBrokers);
        return estate;
    }
}
